package com.inexas.cu.client.mvp;

import java.util.*;
import com.google.gwt.validation.client.interfaces.*;

public interface TupleList<T extends Tuple> extends Container, IValidatable, Iterable<T> {

	/**
	 * PmObserver is implemented as part of the aggregation. As changes are made
	 * to the members of this tuple list we must also fire changes saying that
	 * the list has changed.
	 */
	void onChanged(Source source, Notification notification);

	boolean add(Source source, T tuple);

	void add(Source source, int index, T tuple);

	boolean addAll(Source source, Collection<T> collection);

	boolean addAll(Source source, int index, Collection<T> collection);

	void clear(Source source);

	boolean remove(Source source, T tuple);

	T remove(Source source, int index);

	boolean removeAll(Source source, Collection<T> toRemoveCollection);

	boolean retainAll(Source source, Collection<T> collection);

	T set(Source source, int index, T tuple);

	boolean contains(T tuple);

	boolean containsAll(Collection<T> collection);

	T get(int index);

	int indexOf(T tuple);

	boolean isEmpty();

	Iterator<T> iterator();

	int lastIndexOf(T tuple);

	ListIterator<T> listIterator();

	ListIterator<T> listIterator(int index);

	int size();

	// Not support by Google List<T> subList(int fromIndex, int toIndex);

	T[] toArray();

	// !todo It would be nice if we could hide this method
	void setBinder(Binder binder);

}